#include "DList.h"

void TestList1()
{
	LTNode* phead = ListInit();
	ListPushBcak(phead, 1);
	ListPushBcak(phead, 2);
	ListPushBcak(phead, 3);
	ListPushBcak(phead, 4);
	ListPushBcak(phead, 5);
	ListPrint(phead);

	ListPopBcak(phead);
	ListPrint(phead);
	ListPopBcak(phead);
	ListPrint(phead);
	ListPopBcak(phead);
	ListPrint(phead);
	ListPopBcak(phead);
	ListPrint(phead);
	ListDestory(phead);
	phead = NULL;
}
void TestList2()
{
	LTNode* phead = ListInit();
	ListPushFront(phead, 1);
	ListPushFront(phead, 2);
	ListPushFront(phead, 3);
	ListPushFront(phead, 4);
	ListPushFront(phead, 5);
	ListPrint(phead);

	ListPopFront(phead);
	ListPrint(phead);
	ListPopFront(phead);
	ListPrint(phead);
	ListPopFront(phead);
	ListPrint(phead);
	ListPopFront(phead);
	ListPrint(phead);
	ListDestory(phead);
	phead = NULL;
}
void TestList3()
{
	LTNode* phead = ListInit();
	ListPushBcak(phead, 1);
	ListPushBcak(phead, 2);
	ListPushBcak(phead, 3);
	ListPushBcak(phead, 4);
	ListPushBcak(phead, 5);
	ListPrint(phead);

	ListPopBcak(phead);
	ListPrint(phead);
	ListPopBcak(phead);
	ListPrint(phead);

	ListPushFront(phead, 10);
	ListPushFront(phead, 20);
	ListPushFront(phead, 30);
	ListPrint(phead);

	ListPopFront(phead);
	ListPrint(phead);
	LTNode* pos = ListFind(phead, 2);
	if (pos)
	{
		pos->data *= 100;
	}
	ListPrint(phead);
	ListDestory(phead);
	phead = NULL;
}
int main()
{
	//TestList1();
	//TestList2();
	TestList3();

	return 0;
}